import { GithubApiService } from "./GithubApiService";
import { Repo } from "./model/Repo";
import { User } from "./model/User";
import * as Lodash from "lodash";

let api: GithubApiService = new GithubApiService();
// // api.getUserInfo("nickname", (user: User) => {
// //   console.log(user);
// // });

// api.getRepo("nickname", (repo: Repo) => {
//   console.log(repo);
// });
api.getUserInfo("nickname", (user: User) => {
  console.log(user);
  console.log("==================");
  api.getRepo(user.login, (repos: Repo[]) => {
    let sortRepos = Lodash.sortBy(repos, [(repo: Repo) => repo.size * -1]);
    user.repos = sortRepos;
    console.log(user);
  });
});
